import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
import mongoose from 'mongoose'

@Schema({ timestamps: true })
export class User {
  @Prop()
  username: string

  @Prop()
  password: string

  @Prop()
  phone: string

  @Prop()
  email: string
  @Prop()
  brand: string
  @Prop()
  region: string
  @Prop()
  shop: string
  @Prop()
  status: boolean

  @Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'Role' })
  role: mongoose.Schema.Types.ObjectId

  _id: mongoose.Schema.Types.ObjectId
}

export const UserSchema = SchemaFactory.createForClass(User)
